package com.chenyaowei.order.mapper;

import com.chenyaowei.order.domain.CywOrder;
import com.chenyaowei.order.vo.MonthTurnoverVO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 订单Mapper接口
 *
 * @author 陈耀威
 * @date 2023-12-03
 */
public interface CywOrderMapper
{
    /**
     * 查询订单
     *
     * @param id 订单主键
     * @return 订单
     */
    public CywOrder selectCywOrderById(Long id);

    /**
     * 查询订单列表
     *
     * @param cywOrder 订单
     * @return 订单集合
     */
    public List<CywOrder> selectCywOrderList(CywOrder cywOrder);

    /**
     * 新增订单
     *
     * @param cywOrder 订单
     * @return 结果
     */
    public int insertCywOrder(CywOrder cywOrder);

    /**
     * 修改订单
     *
     * @param cywOrder 订单
     * @return 结果
     */
    public int updateCywOrder(CywOrder cywOrder);

    /**
     * 删除订单
     *
     * @param id 订单主键
     * @return 结果
     */
    public int deleteCywOrderById(Long id);

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteCywOrderByIds(Long[] ids);

    CywOrder selectOrderByOrderSn(@Param("orderSn") String orderSn);

    int updateOrderStatus(@Param("orderSn") String orderSn, @Param("status") Integer status);

    List<CywOrder> selectTimeOutOrderList();

    List<MonthTurnoverVO> monthTurnoverSum(@Param("yearStart") Date yearStart, @Param("yearEnd") Date yearEnd);

    BigDecimal totalTurnoverSum(@Param("todayStart") Date todayStart, @Param("todayEnd") Date todayEnd);
}
